﻿using System;
using Zeus.Thunder.Core;
using CsharpTrainer.MongoDB.Model;
using CsharpTrainer.MongoDB.DAL;

namespace SharpTrainer.MongoDB
{
    class MongoDelTest : ITestCase
    {
        public void Run()
        {
            MongodbHelper<CsharpTrainer.MongoDB.Model.Person> helper = new MongodbHelper<CsharpTrainer.MongoDB.Model.Person>();

            //删除peter这个记录
            helper.Delete(i => i.Name == "peter");

            Console.WriteLine("Delete Successful!");

            Console.WriteLine("Query for peter:");
            CsharpTrainer.MongoDB.Model.Person person = helper.Single(a => a.Name == "peter");
            if (person == null)
                Console.WriteLine("No this person");
            else
                Console.WriteLine(person);
        }
    }
}
